<?php
	session_start();
	$id = $_SESSION['userId'];
	
	// Getting Username from userId
	$name =  getUsername($id);
	$email =  getEmail($id);

	$avatarPath=userimage($id, 'large')."?time=".time();

?>
<div id="content" class="">
    <div class="topShadow"></div>
    <div id="profile">
        <!--  Profile Starts -->
        <div id="avatar" class="left">
            <div id="dpOverlay" class="hide"><img class="proLoading" src="img/ajax-loader.gif" /></div>
            <img id="dPic" alt="" src="<?php echo $avatarPath; ?>" style="width: 150px; height: 150px;"/>
            <div id="dpUploadBtn" data-uid="<?php echo $_SESSION['userId']; ?>">Change Photo</div>
        </div>
        
        <!-- Detail Info -->
        <div id="sumup" class="left">
            <div class="display">
                <div id="namePlay">
                    <h1 class="left"><?php echo $name; ?></h1>
                    <div class="right"><!-- where follow button use to appear --></div>
                </div>
				<div class="clear"></div> 
                
                <div id="editDisplay" class="settingsWrap hide">
                    <div class="right"> 
                        <button id="saveProfile" type="button" value="<?php echo $id; ?>" class="btnB">Save</button>
                    </div>
                    <form action="" method="get">
                        <div class="editPlay">
                            <div class="label">Email</div>
                            <input id="playEmail" name="email" type="text" value="<?php echo $email; ?>" class="left"/>
                            <div class="clear"></div>
                             <div id="setEmailError" class="errorMsg hide rError setErrors eErrors">
                                <span id="setEmailInvalid" class="hide rError eErrors">Invalid Email</span>
                                <span id="setEmailNull" class="hide rError eErrors">Please provide us an Email</span>
                                <span id="setEmailExist" class="hide rError eErrors">Someone has already registered this Email</span>
                             </div>
                        </div>
                         <div class="editPlay">
                            <div class="label">New Password</div>
                            <input id="playPwd" name="password" type="password" placeholder="password" class="left"/>
                            <div class="clear"></div>
                            <div id="setPwdError" class="errorMsg hide rError setErrors pErrors">
                                <span id="setPwdNull" class="hide rError pErrors">Password field cannot be blank.</span>
                             </div>
                            <input id="playId" name="userId" type="hidden" value="<?php echo $id; ?>" />
                        </div>
                    </form>
                </div>
                
                <div id="detailsPlay" class="settingsWrap">
                    <div id="setEditSuccess" class="successMsg hide">
                        <span id="setEPS" class="hide">Succesfully saved.</span>
                    </div>
                    <div id="setEditFail" class="failMsg hide">
                        <span id="setEPF" class="hide">Data could not be saved at the moment. Please try again later.</span>
                    </div>
                    <div class="clear"></div>
                    <div class="right"><button id="editProfile" type="button" value="someValue" class="btnO">Edit</button></div>
                    <div class="editPlay">
                        <div class="label">Email</div>
                        <span id="spanEmail"><?php echo $email; ?></span>
                    </div>
                    <div class="editPlay">
                        <div class="label">Password</div>
                        ********
                    </div>
                </div> 
                <div id="subscribePlay" class="settingsWrap">
                    <div id="setSubSuccess" class="success-msg hide">
                        <span id="setSPS" class="hide">You've successfully unsubscribed from email notifications.</span>
                    </div>
                    <div id="setSubFail" class="fail-msg hide">
                        <span id="setSPF" class="hide">We encountered an error. Please try again later.</span>
                    </div>
                    <div class="clear"></div>
                    <div class="right"><button id="subscribeBtn" type="button" value="<?php echo $profileId; ?>" class="btnB hide">Save</button></div>
                    <div class="editPlay">
                        <div id="subsLabel" class="label h-top">Email Notifications</div>
                        <input id="subsIp" name="subscribe" type="checkbox" value="true" class="sCheckBox left" <?php if(issubscribe($_SESSION['userId'])) { ?> checked="checked" <?php } ?>/>
                        <div id="s-true" class="left">Subscribe to email notification.</div>

                        <div class="clear"></div>
                    </div>
                </div> <!-- ENDS  <div id="subscribePlay"> -->
             </div>  <!-- ENDS  <div id="display"> -->
        </div>
    <div class="clear"></div>        
    </div> <!--  <div class="profile"> END -->
    <div class="bottomShadow"></div>
</div>